package org.bookshare.validator;

import java.io.IOException;

import org.benetech.event.EventListener;
import org.bookshare.document.beans.DocumentSet;
import org.bookshare.document.beans.DocumentType;
import org.bookshare.validator.report.ValidationMetadata;

/**
 * Validate a given resource.
 *
 * @author Reuben Firmin
 * @param <T> the documenttype that this validator can handle.
 */
public interface Validator<T extends DocumentType> {

    /**
     * Given a document set, return a ReportMetadata object which can be used
     * to create a validation report.
     *
     * @param documentSet the documents to validate
     * @param listener the user feedback class
     * @throws IOException if the file cannot be accessed, or is of a different
     * format than expected.
     * @return never null, empty indicates no violations.
     */
    ValidationMetadata validate(DocumentSet<T> documentSet, EventListener listener)
    throws IOException;
}
